package com.example.droideep.fragment.pager;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import java.util.ArrayList;
import java.util.List;

/**
 * @author bri
 * @date 15-5-19.
 */
public class PagerTestAdapter extends FragmentPagerAdapter {
    private static final List<PagerTest> EMPTY = new ArrayList<>();

    private List<PagerTest> items = EMPTY;

    public PagerTestAdapter(FragmentManager fm) {
        super(fm);
    }

    @Override
    public Fragment getItem(int position) {
        return items.get(position).fragment;
    }

    @Override
    public int getCount() {
        return items.size();
    }

    public void setItems(List<PagerTest> items) {
        this.items = items;
        notifyDataSetChanged();
    }
}
